<?php require 'Public/header.php';?>
<body>
<link rel="stylesheet" type="text/css" href="Public/org/home/css/show.css"/>
<script type="text/javascript" src="Public/org/hdjs/hdjs.min.js"></script>
  <link rel="stylesheet" type="text/css" href="Public/org/hdjs/hdjs.css"/>
<!-- <script type="text/javascript" src="<?php echo __VIEW__?>/Detail/js.js"></script> -->
<?php require 'Public/homeTop.php';?>
  <?php foreach($goods as $gd):?>
  <!--列表分类-->
  	<div class="showSortArea">
  		<div class="showSort">
  			<p class="showSortTitle">
  				首页 &nbsp;>&nbsp;
  				<span>男装&nbsp;&nbsp;</span>
  				<!-- <span>衬衫&nbsp;>&nbsp;</span>
  				<span>长袖衬衫&nbsp;>&nbsp;</span>
  				凡客衬衫 牛仔布 领尖扣 男款   -->  				
  			</p>
  			<div class="showCon">
  				<!--title-->
  				<section class="Title">
  					<h2><?php echo $gd['goods_name']?></h2>
  				</section>
  				<!--作数据循环的品牌框-->
  				<!-- <section class="showDetail">
  					<ul>
  						<li><a href="#">产品描述&nbsp;|</a></li>
  						<li><a href="#">&nbsp;评论</a></li>
  					</ul>
  				</section>    --> 				
  			</div>
  		</div>
  	</div>
  <!--列表分类end-->
  
 <!--展示-->
 		<div class="showGoodsArea">
 			<!--居中框-->
 			<div class="showGoods">
 				<!--左边图片框-->
 				<div class="goodsBox">
 					<!--小图框-->
 					<section class="smallImg">
 						<i class="icon-caret-up up"></i>   						  						
 						<ul>
 							<li style="margin-top:3px"><img src="<?php echo $gd['thumb_pic']?>"/></li>
 							<li><img src="<?php echo $gd['thumb_pic']?>"/></li>
 							<li><img src="<?php echo $gd['thumb_pic']?>"/></li>
 							<li><img src="<?php echo $gd['thumb_pic']?>"/></li>
 							<li><img src="<?php echo $gd['thumb_pic']?>"/></li>
 						</ul>
 						<i class="icon-caret-down down"></i> 
 					</section>
 					<!--大图框-->
 					<section class="showImg">
 						<img src="<?php echo $gd['middle_pic']?>" alt="" />
 					</section>
 				</div>
 				<!--详情框-->
 				<div class="goosDetail">
 					
 					<section class="showDetail">
 						<p class="one">
 							<span class="titleOne">售价：</span>
 							￥<strong id="cash" class="cash"><?php echo $gd['price']?></strong>
 						</p>
 						<p class="two">
 							<span style="display:inline-block" class="titleTwo">颜色：</span>
              <?php foreach($gd['attr_value'] as $gdv):?>
                <?php if($gdv['attr_name']=='颜色'):?>
 							    <span class="con color"><?php echo $gdv['attr_value']?></span>
                <?php endif;?>
            <?php endforeach;?>
 							<!-- <span class="con">黑色</span> -->
 						</p>
 						<p class="three">
 							<span style="display:inline-block" class="titleThree">尺码：</span>
              <?php foreach($gd['attr_value'] as $gdv):?>
                <?php if($gdv['attr_name']=='尺寸'):?>
 							    <span class="con size"><?php echo $gdv['attr_value']?></span>
                <?php endif;?>
              <?php endforeach;?>
 							<!-- <span class="con">M</span>
 							<span class="con">L</span>
 							<span class="con">XL</span>
 							<span class="con">XXL</span> -->
 						</p>
 						<p class="four">
 							<span class="titleFour">数量：</span>
 							<select name="num" id="num">
 								<option value="1" selected="selected">1&nbsp;</option>
 								<option value="2">2&nbsp;</option>
 							</select>
 						</p>
 						<p class="five">
 							<span class="titleFive">已选：</span>
 							<span class="last"></span>
              <span class="lastsize"></span>
              <label></label>
 							<strong>现在有货</strong>
 						</p>
 						<p class="six">
 							<a href="javascript:;" onclick="joinPay()"><span class="buy">立刻购买</span></a>
 							<span class="cart" onclick="joinCart()">&nbsp; </span>
 						</p>
 					</section>
 				</div>
 			</div>
 		</div>
 <!--展示end-->
 
 	<!--宝贝详情-->
 		<div class="detailArea">
 			<div class="detailText">
 				<p class="title">产品描述：</p>
 				<p class="con"><?php echo $gd['description']?></p>
 			</div>
 			<div class="detailAttr">
 				<p class="title">产品属性：(点击属性可查看同类商品)</p>
 				<ul>
          <?php foreach($public as $attr):?>          
 					<li><?php echo $attr['attr_name']?>：<a href="#"><?php echo $attr['attr_values']?></a></li>
          <?php endforeach;?>
 				</ul>
 			</div>
 			<div class="detailWash">
 				<p class="title">洗涤说明：</p>
 				<span class="washOne"></span>
 				<span class="washTwo"></span>
 				<span class="washThree"></span>
 				<span class="washFour"></span>
 				<span class="washFive"></span>
 			</div>
 			<div class="detailImg">
 				<p class="title">详情图片：</p>
 				<p class="con">注： 商品实际颜色以静物图为准</p>
       
 				<span class="imgOne">
         <?php echo $gd['content']?>
        </span>
 				
 			</div>
 		</div>   			
 	<!--宝贝详情end-->
 	<?php endforeach;?>
 	 <!-- 引用页脚文件 -->
  <?php require 'Public/footer.php';?> 
</body>
<!-- 点击显示选择的内容 -->
<script type="text/javascript">
  var color = null;
  var size = null;
  var num = $('#num').find('option:selected').val();
  $(function(){  
    // 点击选定颜色
    $('.color').click(function(){
      $(this).css('border','2px solid red').siblings('.color').css('border','1px solid #eee');
      color = $(this).text();
      $('.last').html(color);
    });
    // 点击算定尺寸
    $('.size').click(function(){
      $(this).css('border','2px solid red').siblings('.size').css('border','1px sold #eee');
      size = $(this).text();
      $('.lastsize').html(size);
    });
    // 点击选定数量，默认为1

    $('#num').change(function(){
      num = $('#num').find('option:selected').val();
    });
  })
  function joinCart()
  {
    var color = $('.last').text();
    var size = $('.lastsize').text();
    if(color=='' || size==''){
       hd_alert({
              message: '请选择属性',//显示内容
              timeout: 1,//显示时间
          });
      return false;
    }
    var goods_id = <?php echo $_GET['goods_id']?>;
    $.post("index.php?m=Home&c=Cart&a=joinCart",{goods_id:goods_id,color:color,size:size,cartnum:num},function(data){
      hd_alert({
              message: data.message,//显示内容
              timeout: 1,//显示时间
          });
        $('#joinCart').html(data.cartNum);
    })
  }

  function joinPay()
  {
    var color = $('.last').text();
    var size = $('.lastsize').text();
    if(color=='' || size==''){
      hd_alert({
              message: '请选择属性',//显示内容
              timeout: 1,//显示时间
          });
      return false;
    }
    var goods_id = <?php echo $_GET['goods_id']?>;
    $.post("index.php?m=Home&c=Cart&a=joinCart",{goods_id:goods_id,color:color,size:size,cartnum:num},function(data){
        location.href="index.php?m=Home&c=Cart&a=cart";
    })
  }      
</script>
<!-- 点击显示选择的内容end -->
</html>


















